package com.game.code;

import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.BodyDef;
import org.jbox2d.dynamics.FixtureDef;
import org.jbox2d.dynamics.World;

public class Border {
	public static final float WORLD_PHYSICS_SIZE = 10;

	public Border(World world){
		
		PolygonShape shape = new PolygonShape();
		BodyDef bd = new BodyDef();
		bd.position.set(0.0f, 0.0f);
		Body border = world.createBody(bd);

        FixtureDef fd = new FixtureDef();
        fd.restitution = 1f;
        fd.friction = 0.0f;
        fd.density = 10.0f;
		
		shape.setAsEdge(new Vec2(-WORLD_PHYSICS_SIZE/2,-WORLD_PHYSICS_SIZE/2), new Vec2(WORLD_PHYSICS_SIZE/2,-WORLD_PHYSICS_SIZE/2));
        fd.shape = shape;
        border.createFixture(fd);
		shape.setAsEdge(new Vec2(-WORLD_PHYSICS_SIZE/2, WORLD_PHYSICS_SIZE/2), new Vec2(-WORLD_PHYSICS_SIZE/2,-WORLD_PHYSICS_SIZE/2));
        fd.shape = shape;
        border.createFixture(fd);
		shape.setAsEdge(new Vec2( WORLD_PHYSICS_SIZE/2, WORLD_PHYSICS_SIZE/2), new Vec2( WORLD_PHYSICS_SIZE/2,-WORLD_PHYSICS_SIZE/2));
        fd.shape = shape;
        border.createFixture(fd);
	}
	
}
